#ifndef __INCtypeh
#define __INCtypeh
#include <stdint.h>

#define	IMPORT	           extern
#define	LOCAL	           static
#define OK                 (0)
#define RET_ERROR          (-1)
#define RET_EXCEPTIONAL    (128)
#define RET_TIMEOUT        (129)
#define RET_INDIDE_ERR     (130)
#define RET_STAT_D         (131)
#define TV_USEC_VALUE      (200)
#define INVALUE_INAVLE     RET_ERROR
#define UNUSED(x)          (void)(x) //avoid gcc warning: unused variable
#define MAX(x, y)          (((x) < (y)) ? (y) : (x))
#define MIN(x, y)          (((x) < (y)) ? (x) : (y))
#define SHIFT_BIT(n)       (1 << (n))
#define KILOBYTE           (1024UL)
#if !defined(_WIN32) && !defined(MAX_PATH)
#define MAX_PATH           (1024)
#endif
#ifndef TRUE
#define TRUE               (1U)
#endif
#ifndef FALSE
#define FALSE              (0U)
#endif
#define ENDL               '\n'
#define ENDLS              "\n"
#define EOFS               '\0'
#define SPACES             " "
#define SPACE              ' '
#define NULLSTR            ""
#define DQUOTES            "\""
#define DQUOTE             '"'
#define CR_CHAR            '\r'
#define DEFAULT_CONFIG_PATH "cfg"

// Conditional check return value
#define COND_CHECK_RET_VAL(_cond, _retVal)                   \
    do                                                       \
    {                                                        \
        if (_UNLIKELY((_cond)))                              \
        {                                                    \
            return _retVal;                                  \
        }                                                    \
    } while (0)

// typedef unsigned char  uint8_t;
// typedef unsigned short uint16_t;
// typedef unsigned int   uint32_t;

/* These types must be 16-bit, 32-bit or larger integer */
typedef int		    INT;
typedef uint32_t	UINT;
typedef uint64_t    UINT64;
/* These types must be 8-bit integer */
#ifndef _WIN32
typedef int8_t		CHAR;
#endif
typedef uint8_t		UCHAR;
typedef uint8_t		BYTE;

/* These types must be 16-bit integer */
typedef int16_t		SHORT;
typedef uint16_t	USHORT;
typedef uint16_t	WORD;

#ifndef _WIN32
/* These types must be 32-bit integer */
typedef uint32_t	LONG;
typedef uint32_t	ULONG;
typedef uint32_t	DWORD;
typedef uint8_t		BOOL;
#else
typedef intptr_t    ssize_t;
#endif
typedef int         STATUS;

#endif
